#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;
int a, b, c;
bool prime(int x)
{
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return 0;
	}
	return 1;
}
int main()
{
	int t;
	cin >> t;
	while(t--){
		scanf_s("%d%d%d", &a, &b, &c);
		int arr[3] = { a,b,c };
		if (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
			printf("R\n");
			continue;
		}
		int sum = a + b + c;
		if (sum % 2 == 1) {
			printf("P\n");
			continue;
		}
		int idx = 0;
		for (int i = 0; i < 3; i++) {
			if (arr[i] % 2 == 0)idx = arr[i];
		}
		/*bool flag = 0;
		if (prime(idx + 1)) {
			if (idx >= 2)flag = 1;
		}
		if (sum - idx == 2)flag = 1;
		if (flag)printf("R\n");
		else printf("P\n");*/
		int ans = 0, ans1 = 0, ans2 = 0;
		for (int i = 0; i < 3; i++) {
			if (arr[i] % 2 == 0) {
				ans = arr[i];
			}
			else {
				ans1 = arr[i];
			}
		}
		ans2 = sum - ans1 - ans;
		
		if (ans1 == 1 && ans2 == 1) {
			printf("R\n");
			continue;
		}
		bool flag = 0;
		//cout << "111" << endl;
		if (prime(ans + ans1) && prime(ans + ans2)) {
			if (ans >= 2) {
				flag = 1;
			}
		}
		if (flag)printf("R\n");
		else printf("P\n");
	}
	return 0;
}
//8 3 3
//8 3 1